package cn.jltx.mvpdemopro.model;

import android.text.TextUtils;

/**
 * @author jltxseo
 *         Created by junlintianxia on 2016/04/5.
 */

public class User implements IUser{
    private String username;
    private String password;

    public User(String username, String password) {
        this.username = username;
        this.password = password;
    }

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    @Override
    public int checkUserValidity(String name, String passwd) {
        if(TextUtils.isEmpty(name) || (!username.equals(name))){
            return -1;
        }else if(TextUtils.isEmpty(passwd) || (!password.equals(passwd))){
            return 0;
        }else {
            return 1;
        }
    }

    @Override
    public String toString() {
        return "correct user:"+(username != null ? username : "null" )+"      " +(password != null ? password : "null");
    }
}
